Skip to content

fix(permissions): allow decision-script reads, ask on --set/--clear, stop allowing install-claude-hooks.sh (#782) - #785

Merged
MendixMau merged 2 commits into
masterfrom
triage/782-permission-followups
Nov 16, 2026
Merged

MendixMau merged 2 commits into
masterfrom
triage/782-permission-followups

Conversation

@MendixMau

Copy link
Copy Markdown
Owner

Fixes #782

Direct lane

What changed and why (one paragraph): #781 kept every script that records a person's decision out of the allow list. That kept --set prompting. But it also meant the read before each exec (<toolkit>/bin/exec-approval.sh <project>, bin/lib/wiring-item3.sh:33) prompted every time, so exec approval auto still prompted on every exec. The same applied to interview-mode.sh <proj> --explain and the permission-profile.sh read. Meanwhile install-claude-hooks.sh still got an allow rule, although it writes ~/.claude/settings.json and its hooks fire in every repo on the machine.

What changes in bin/install-claude-permissions.sh:

  • Allowed again: exec-approval.sh, interview-mode.sh and permission-profile.sh, with the same per-script rules as every other script. They exist only in the toolkit's bin/, so the rules are the local absolute-path ones.
  • Writers still prompt: the only state-changing arguments of these three scripts are --set <value> and --clear; --explain, --remote and the bare call only read. Six ask rules cover the writers: Bash(*<script>*--set*) and Bash(*<script>*--clear*). They go into the shared settings.json under every profile, wrappers included. An ask rule beats an allow rule, including full's bare Bash.
  • No longer allowed: install-claude-hooks.sh. It joins the exclusion case, EXPECTED_LOCAL and the T12 grep.

Migration goes through the existing sidecars:

  • A re-install adds the ask rules and removes the hooks-installer allow rule that an earlier install recorded.
  • An identical-looking rule that someone else wrote, with no sidecar record, is left alone.
  • --check (and so sync-project.sh's WARN) names the stale rule and the missing ask rules until that re-install.

Impact

Row Answer
Process No new gate or block. sync-project.sh's existing permission --check WARN fires once on every project installed before this change, until install-harness-permissions.sh <project> is re-run. After the re-install, under exec approval auto, the per-exec mode read no longer prompts. --set/--clear of the three scripts now prompts in every profile. That is new under full, where the bare Bash used to let them through.
Dependencies bin/install-claude-permissions.sh, the fixture and CHANGELOG only. It builds on #781, which is merged. Exit codes and output format are unchanged.
Context cost none: no routed or always-loaded file touched
Behaviour n/a: scripts only
Runtime Install and --check stay at ~0.14 s, within noise. Nothing runs per exec. Shared settings.json gains 6 ask rules. Local settings.local.json gains 6 allow rules and loses 2 (the hooks installer).

Time cost: per project (install/sync check) · ±0.01 s on a Linux container · can force rework: n · offset: removes the permission prompt on the exec-approval read before every exec under auto, and on interview-mode.sh --explain

Field evidence (claude 2.1.325, 2026-11-16; the maintainer authorised small model calls for this proof, as for #781). Setup: a throwaway project installed by this branch with the wrappers profile. The shared and local files were merged and passed through --settings, and each command was run with claude -p … --permission-mode default --output-format json --max-turns 3.

rules command outcome permission_denials
branch <tk>/bin/exec-approval.sh <proj> ran, printed auto 0
branch bash <tk>/bin/interview-mode.sh <proj> --explain ran 0
branch <tk>/bin/exec-approval.sh <proj> --set auto refused, not run 1
branch <tk>/bin/permission-profile.sh <proj> --clear refused, file kept 1
branch <tk>/bin/install-claude-hooks.sh --dry-run --full "This command requires approval" 1
master (1e0c38a) <tk>/bin/exec-approval.sh <proj> "This command requires approval" 1
branch minus the ask rules, in a dir with no .claude/ (control) --set ask ran, wrote the file 0
branch, same dir --set auto refused, file stayed ask 1

The control shows that the ask rule is what stops --set. --debug also shows that Claude Code drops a not-yet-trusted workspace's project allow entries but still applies its project ask and deny rules. So the committed ask rules protect even an untrusted checkout.

Fixture: tests/wave2/test-install-claude-permissions.sh. T12 gains seven cases (one existing case is reworded), and its matcher now applies "ask beats allow". The cases check:

  • the excluded scripts get no allow rule;
  • the three reads are allowed in every spelling, and no ask rule catches them;
  • every --set and --clear spelling hits an ask rule;
  • the ask rules are present under full;
  • --check on an install shaped like fix(permissions): one allow rule per script, * only at the end (#780) #781's output names the stale and missing rules;
  • the re-install migrates;
  • foreign entries survive.

Results:

  • master's script under the branch fixture: PASS=190 FAIL=10
  • this branch: PASS=200 FAIL=0

Other fixtures:

  • test-look-hook-cwd.sh 9/0 and test-look-ledger-hook-repair.sh 13/0.
  • test-model-stamp.sh T8 replicated by hand: all four checks hold.
  • test-file-bugs.sh's permission check, by inspection: the deny strings are unchanged.
  • check-scripts, the leak guard, check-portability and check-pr-discipline are clean.

Not covered here: under the project profile, Edit(/**) still lets the Edit tool write .mxtk/exec-approval or the Exec approval: line in PROJECT.md directly. That gap was there before this PR and is outside #782's scope.

  • No client data anywhere in the diff
  • Size cap: 3 files, ~25 non-fixture lines
  • Test tier reached: fixture plus a real Claude Code run
  • For a changed instrument: the golden input is the installer's real output. Both layouts and bash 3.2 are safe.
  • For a new skill: n/a
  • CHANGELOG.md line appended, crediting the two independent reviews of fix(permissions): one allow rule per script, * only at the end (#780) #781
  • New bug entries: n/a

Review: pending independent review


Generated by Claude Code

…stop allowing install-claude-hooks.sh (#782)

exec-approval.sh, interview-mode.sh and permission-profile.sh get allow rules again, so the
read before every exec no longer prompts under exec approval `auto`. Their only writers,
`--set` and `--clear`, sit behind six shared ask rules under every profile; ask beats allow.
install-claude-hooks.sh joins the exclusion list: it writes ~/.claude/settings.json for every
repo. Migration goes through the existing sidecars; foreign entries are untouched.

Field run, claude 2.1.325: the read ran with no denial, `--set auto` and `--clear` were
refused, and with the ask rules removed `--set` ran.

Fixes #782

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXpQSjXefSNicGGqP4aiSC
@MendixMau

Copy link
Copy Markdown
Owner Author

Review: MERGE. No ordinary spelling of a state-changing call to the three scripts gets past *--set*/*--clear*. The migration works on a real install made by master's script (the #781 version).

Value: Fixes #782 as reported.

  • The three decision scripts get local allow rules again (bin/install-claude-permissions.sh:197-204).
  • DECISION_ASK covers their writers (:269-277).
  • install-claude-hooks.sh joins the exclusion case (:204).
  • Each script writes only when $2 is exactly --set or --clear (exec-approval.sh:51,73-88, interview-mode.sh:47,80-94, permission-profile.sh:31,49-62).
    • There is no --set= form, abbreviation or other writer.
    • Env vars only change what that process reads.

Regression risk:

  • Migration, run for real: I installed with master, then re-ran with the branch. --check exits 1 and names the 6 missing ask rules and the 2 stale hooks rules. The re-install adds 6 ask rules and 6 local allow rules and removes 2. The next --check exits 0.
  • Ask rules: the leading * in the globs works in both layouts and on Git Bash. ASK+= keeps the ask rules of the project and full profiles.
  • claude doctor: version 2.1.325 under full flags none of the new rules.
  • Side effect: *--set* also matches --settings. That is harmless.

Correctness:

  • The fixture models deny > ask > allow correctly.
  • Fixture runs, detached worktree:
Fixture Result
test-install-claude-permissions 200/0
test-model-stamp 35/0
test-file-bugs 218/0
  • Residual risk, not exercised: a split spelling (--se""t, "$X") may get past a text-matching ask rule. Under project, Edit(/**) can already write the state file directly, so these rules guard against ordinary spellings and are not a hard boundary.

Context cost: 66,271 → 66,271 (measured).

Time cost: install and --check only, 0.122 s → 0.127 s. Nothing runs per build row.


Generated by Claude Code

@MendixMau
MendixMau merged commit 99ce7f5 into master Nov 16, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

permissions follow-ups from #781: read-only approval checks still prompt; install-claude-hooks.sh runs unprompted

2 participants